import Req from './req.js';
const API = {
    // 根据关键字爬取百度百科数据
    getReptile: (params = {}, callback) => {
        Req.get('/reptile', params, res => {
            callback && callback(res);
        })
    },
    // 获取门
    getDoor: (params = {}, callback) => {
        Req.get('/doors', params, res => {
            callback && callback(res);
        })
    },
    // 获取全部纲
    getOutlineAll: (params = {}, callback) => {
        Req.get('/outline/all', params, res => {
            callback && callback(res);
        })
    },
    // 获取门的纲
    getOutline: (params = {}, callback) => {
        Req.get(`/outline`, params, res => {
            callback && callback(res);
        })
    },
    // 获取全部科
    getSectionAll: (params = {}, callback) => {
        Req.get('/section/all', params, res => {
            callback && callback(res);
        })
    },
    // 获取纲的科
    getSection: (params = {}, callback) => {
        Req.get(`/section`, params, res => {
            callback && callback(res);
        })
    },
    // 获取全部属
    getGenusAll: (params = {}, callback) => {
        Req.get('/genus/all', params, res => {
            callback && callback(res);
        })
    },
    // 获取科的属
    getGenus: (params = {}, callback) => {
        Req.get(`/genus`, params, res => {
            callback && callback(res);
        })
    },
    // 获取全部植物
    getPlantAll: (params = {}, callback) => {
        Req.get(`/botanys/condition/all/botanys`, params, res => {
            callback && callback(res);
        })
    },
    // 根据关键字获取输入提示
    getTip: (params = {}, callback) => {
        Req.get(`/botanys/condition/tip/${params.keyword}`, {}, res => {
            callback && callback(res);
        })
    },
    // 根据条件获取植物信息
    getPlantCondition: (params = {}, callback) => {
        Req.get(`/botanys/condition`, params, res => {
            callback && callback(res);
        })
    },
    // 根据id获取植物信息
    getPlantById: (params = {}, callback) => {
        Req.get(`/botanys/condition/${params.botanyId}`, {}, res => {
            callback && callback(res);
        })
    },
    // 注册
    register: (params = {}, callback) => {
        Req.post(`/users/register`, params, res => {
            callback && callback(res);
        })
    },
    // 登录
    login: (params = {}, callback) => {
        Req.post(`/users/login`, params, res => {
            callback && callback(res);
        })
    },
    // 增加历史记录
    addHistory: (params = {}, callback) => {
        Req.post(`/history`, params, res => {
            callback && callback(res);
        })
    },
    // 获取历史记录
    getHistory: (params = {}, callback) => {
        Req.get(`/history`, params, res => {
            callback && callback(res);
        })
    },
    // 获取历史记录
    delHistory: (params = {}, callback) => {
        Req.get(`/history/del`, params, res => {
            callback && callback(res);
        })
    },
    // 获取短信验证码
    getSms: (params = {}, callback) => {
        Req.get(`/users/sms/${params.phone}`,{} , res => {
            callback && callback(res);
        })
    },
}
module.exports = API;